package com.mjk.common.web.getway.conf.selector;

import com.mjk.common.web.getway.transfer.dubbo.DubboGetWayProtocol;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;

public class BeeDubboTransferRegistrar implements ImportBeanDefinitionRegistrar{
	@Override
	public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,BeanDefinitionRegistry registry) {
		BeanDefinitionBuilder builder = rootBeanDefinition(DubboGetWayProtocol.class);
        
        builder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
		String dubboName = "beeDubboPrototal";
		registry.registerBeanDefinition(dubboName, beanDefinition);
	}

}
